import Vue          from 'vue';
import VueResource  from 'vue-resource';
import Types from './vuex/mutation-types'
import store     from './vuex/store';

Vue.use(VueResource);         //数据请求
//为了解决服务器跨域问题添加
Vue.http.interceptors.push(function () {
      return {
        request: function (request) {
           request.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
           store.dispatch(Types.UPDATE_LOADING,true);
           return request;
       },
       response: function (response) {
           store.dispatch(Types.UPDATE_LOADING,false);
           return response;
       }

      };
});
